<?php

class Math_Calculator{
private $result = 0;
/* constructor and destructor */

function __construct(){
 	$this->setResult(3);	
}


/* getters and setters accessor functions */
public function setResult($result){
	$this->result = $result;
}
public function getResult(){
	return $this->result;
}
/* Math Function */
public function add( $num1, $num2){
	/* Type hinting doesn't work for primitive types so 
	 * Test for numeric values  
	 */
	
	if(is_numeric($num1) && is_numeric($num2))
	{
		$this->result = $num1+$num2;
		return $num1+$num2;
	}
	else die("Arguments must be numeric");
}
public function subtract($num1,$num2){
	$this->result = $num1+$num2;
	return $num1 - $num2;
}
public function multiply($num1,$num2){
	$this->result = $num1*$num2;
	return $num1 * $num2;
}
public function divide($num1,$num2){
	$this->result = $num1/$num2;
	return $num1 / $num2;	
}

}


?>